package com.ellecity06.debugtools.base

import kotlinx.coroutines.CoroutineScope

open class ViewEffect {
    /**
     * 提示
     */
    data class ShowToast(val message: String) : ViewEffect()

    /**
     *显示加载框
     */
    data class ShowLoading(val message: String = "加载中...", val scope: CoroutineScope? = null) : ViewEffect()

    /**
     * 隐藏加载框
     */
    object DismissLoadingDialog : ViewEffect()

    /**
     * 授权过去
     */
    data class AuthorizationExpired(val message: String) : ViewEffect()

    /**
     * 加载失败了
     * @param id 是请求的携带的id
     */
    data class RefreshFail(val message: String, val id: Int? = null) : ViewEffect()
    /**
     * 刷新数据为空
     */
    data class RefreshListEmpty(val message: String? ) : ViewEffect()
    /**
     * 加载数据为空
     */
    data class LoadMoreEmpty(val message: String?=null) : ViewEffect()

    /**
     * 刷新数据成功，指的是第一页
     */
    data class RefreshListSuccess(val list: List<*>,val endOfPaginationReached: Boolean = false) : ViewEffect()

    /**
     * 加载更多数据成功
     * @param endOfPaginationReached 是否已经到达分页的末尾
     */
    data class LoadMoreListSuccess(val list: List<*>, val endOfPaginationReached: Boolean = false) : ViewEffect()

    /**
     * 加载更多数据失败了
     */
    data class LoadMoreListFail(val error: Throwable) : ViewEffect()

}